package com.cloudlead.userAction.Action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.security.annotation.RequireGuest;
import com.cloudlead.userAction.BusinessModules;
import com.cloudlead.userAction.Service.BaseCompanySer;
import com.cloudlead.userService.CompanyService;
import com.cloudlead.userService.vo.BaseCompanyVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created by Administrator on 2015-08-13.
 */
@Controller
public class CompanyAction extends AbstractActionFactory implements CompanyService {

    @Autowired
    BaseCompanySer baseCompanySer;

    public CompanyAction() {

        super(BusinessModules.CompanyRegiter);
    }




    @Action
    @Label("公司注册")
    @Override
    @RequireGuest//取消token验证
    /**
     * 将web页面传过来的userManagementVO对象的值copy给baseCompanyUser。
     * 由于baseCompanyId是BaseCompanyUser中的外键，所以不能完全copy。
     */
    public String companyRegister(BaseCompanyVO baseCompanyVO) {
        if(baseCompanyVO!=null){
            return baseCompanySer.companyRegister(baseCompanyVO);

        }else{

            return "清输入信息。";
        }

    }

    @Action
    @Label("编辑公司信息")
    @Override
    @RequireGuest//取消token验证
    public void companyUpdate(@Label("公司信息")BaseCompanyVO baseCompanyVO) {
            baseCompanySer.companyUpdate(baseCompanyVO);
    }

    @Action
    @Label("根据公司ID查询")
    @Override
    @RequireGuest//取消token验证
    public Object companyFindOne(@Label("公司ID")String id) {
        return baseCompanySer.companyFindOne(id);
    }
}
